﻿<%@ Page Language="C#" MasterPageFile="~/SimplePMTModal.Master" AutoEventWireup="true" CodeBehind="FileView.aspx.cs" Inherits="SimplePMT.FileView" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent">
    <%= fileView %>
    </p>
    <script>
        var tmpId = '';
        var df = document.taskForm;
        var sn = true;
        function associateTask(tid, aid, io) {
            SimplePMT.FileView.AssociateTaskAttachment(tid, aid, io.checked, function(response) {
                if (response.error != null) {
                    alert(response.error.Message);
                }
            });
        }
         
        function showHideAssociations() {
            var mo = document.getElementById('TaskAssociations');
            var io = document.associationsOptionsImage;
            var imgName = io.src.split('/')[io.src.split('/').length - 1];
            if (imgName == 'closed.gif') {
                io.src = 'images/open.gif';
                mo.style.display = 'inline';
            } else {
                io.src = 'images/closed.gif';
                mo.style.display = 'none';
            }
        }
        function confirmDelete(id) {
            if (confirm('Are you sure you want to delete this attachment?')) {
                SimplePMT.FileView.DeleteFile(id, function (response) {
                    alert('File deleted successfully.');
                    pcid = <%= parentContainerId %>;
                    if (pcid > 0) {
                        top.reloadParentNode(<%= parentContainerId %>, top.document.img<%= parentContainerId %>);
                         top.win.close();
                    } else {
                        top.location.reload();
                    }
                });
            }
        }
        
        function saveFile() {
            document.attachmentForm.submit();
        }
    </script>
</asp:Content>